1. Using ModelFlow with World Bank models#

The ModelFlow python package has been developed to solve a wide range of models, see the ModelFlow github web site for working examples of the Solow Model, the United States’ Federal REserve FRB/US model and others.

The package has been substantially expanded to include special features that enable it to work with World Bank models originally developed in EViews and designed to use the EViews Model Object for simulation.

This chapter illustrates how to access these models, how to load them into a ModelFlow Anaconda environment on your computer, and how to perform a variety of simulations.

Warning

To be updated when final storage for models is sorted.

1.1. Publicly available World Bank models that run under ModelFlow#

At this time several World bank macrostructural models are available to download and use with ModelFlow. These include a macrostructural model for:

  • Indonesia (Climate features)

  • Nepal (Climate features)

  • Croatia (Quarterly model)

  • Iraq (Standard Macro-fiscal model)

  • Uganda (Annual model with climate features)

  • Bolivia (Annual Model)

  • Pakistan (Annual model with climate features)

Each of these models has been developed as part of the outreach work of the World Bank. The basic modelling framework of each of these models is outlined in Burns et al. [2019] with specific extensions reflecting features of the individual country modelled. The basic approach for the models with climate features is laid out in Burns et al. [2021], although several additional features are included in some of these models that has not yet been documented.

As additional models are released they will be made available using the mechanism described below.

The examples in this book use the Pakistan model.

1.2. How to access the models#

A user who has installed the modeflow library will have access to a github repo with World Bank models. The repo can be downloaded with the following code:

model.Worldbank_Models() 

This will download the the World Bank models available in the Github repo: worldbank/MFMod-ModelFlow.

The default location for the download is ./Worldbank models. The user can chose a different location for the download by specifying the parameters:destination and description so:

model.Worldbank_Models(destination='.\horse',description='blue',reset=True) 

will downloaded the repo to .\horse\blue

Warning

A repo can only be downloaded once to the same location. If a repo has already has been downloaded to a location, and a user wants to download it a second time use reset=True. This will delete the folder before the new download.

In this case none of the previous downloaded notebooks should be open, as it prevents the deletion of the folder.

Warning

Jupyter can only run models in subfolders of the of the folder it was started in.

Tip

Below will be changed when the wb repo has been populated. No need to make it fancy before that

model.Worldbank_Models(reset=1) 
Worldbank models is reset, that is deletet 
Repo downloaded to Worldbank models

Avaiable notebooks

1.3. Old example#

model.download_github_repo(reset=1) 
wb-repos is reset, that is deletet 
Repo downloaded to wb-repos

Avaiable notebooks

                  wb-repos\Indonesia
                            Indonesia readme
                            idn electricity tax shock
                            idn oil price shock-Copy1
                            idn oil price shock
                  wb-repos\Nepal
                            Nepal readme
                            npl oil price shock 2 models
                            npl oil price shock
                  wb-repos\nepal check eviews
                            Nepal oilshock in eviews
                            Nepal oilshock in modelflow
                  wb-repos\Pakistan
                            Pakistan readme
                            ScenarioAnalysis
                            Targeting
Menu to start notebooks in subfolders

1.4. .display_toc() Displayed a list of the notebooks in a folder and all its subfolders.#

This this can be used if the user want to display the list of notebooks after the repo has been selected. So the following will display the same as the code above.

model.display_toc(folder= "wb-repos")
Menu to start notebooks in subfolders

2. To do list#

This JN needs to be finished. Need to

  1. decide on a temporary home for models; done

  2. have that home as part of the default in the widget but allow it to be overridden; done

  3. the display_toc needs to be better documented, notably as to where the user is going to have their models saved on their personal machines and how they can customize that and tell the display_toc where to find them. done

Finally not clear why we have to delete, why cannot user overwrite a repo that was already downloaded? done